/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl3;

import java.util.regex.Pattern;

/**
 * Static class for various utilities.
 * 
 * @author Luis Alberto Pérez García <luixal@gmail.com>
 */
public class Utils {

    /**
     * Checks if an {@link String String} is a terminal element.
     *
     * @param s The string to be checked
     * @return True if s is a terminal. Flase if s is a non terminal.
     */
    static boolean isTerminal(String s) {
        return !Pattern.matches("[A-Z][A-Z_]*", s);
    }

    /**
     * Main method for testing purpouses
     * 
     * @param args
     */
    public static void main(String args[]) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        System.out.println("Is AB terminal?" + isTerminal("AB"));
        System.out.println("Is ab terminal?" + isTerminal("ab"));
    }

}